package com.richman.view;

import javax.swing.JPanel;
import javax.swing.JTextField;

import com.richman.controller.BetClient;
import com.richman.utils.Common;

import javax.swing.JLabel;
import javax.swing.JOptionPane;

import java.awt.BorderLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;

import javax.swing.JButton;
import javax.swing.JCheckBox;
import javax.swing.JComboBox;

public class SettingPane extends JPanel {

	/**
	 * 
	 */
	private static final long serialVersionUID = -9999999L;

	/**
	 * Create the panel.
	 */
	
	private JComboBox comboBox;
	
	private String second = "6秒";
	

	private JTextField sideMinTextField;
	private JTextField sumMinTextField;
	private JTextField hgAmountTextField;
	private JTextField ps38AmountTextField;
	private JTextField ps38PercentTextField;
	private JTextField hgMaxBetTextField;
	private JTextField sideMaxTextField;
	private JTextField sumMaxTextField;
	private JTextField betoddTextField;
	
	private JTextField reBetTimeTextField;
	
	private JTextField delayBetTimeTextField;
	
	private JTextField refreshDelayBetTimeTextField;
	
	private JTextField manualBetSuccessTimeTextField;
	
	private JTextField maxdvalueTextField;
	
	private JTextField dvaluelimitTextField;
	
	private JTextField specialMinRatioTextField;
	
	private JTextField newBigMinRatioTextField;
	
	private JTextField specialSecondMinRatioTextField;
	
	private JTextField specialDXQMinRatioTextField;
	
	private JTextField bettimesLimitTextField;
	
	private JTextField newBigBetAmountTextField;
	
	private JTextField specialBetAmountTextField;
	
	private JTextField specialSecondBetAmountTextField;
	
	private JTextField specialDXQBetAmountTextField;
	
	private JTextField specialBetIntervalTextField;
	
	private JTextField specialDXQMinBetTextField;
	
	private JTextField receiveDataIntervalField;
	private JTextField receiveDataIntervalField1;
	
	private JTextField betlimitField;
	
	private JTextField startBetGoldField;
	
	private JTextField forbidTimeStTextField;
	private JTextField forbidTimeEdTextField;
	
	double specialMinRatio = 0.8;
	double newBigMinRatio = 0.8;
	double specialSecondMinRatio = 0.4;
	
	double specialDXQMinRatio = 0.8;
	
	int specialBetAmount = 100000;
	
	int newBigBetAmount = 10000;
	
	int specialSecondBetAmount = 20000;
	
	int specialDXQBetAmount = 10000;
	
	int specialBetInterval = 30;
	
	int specialDXQMinBet = 10;
	
	int forbidTimest = 0;
	int forbidTimeed = 0;
	
	private double sideMinodd = 0.0;
	private double sumMinodd = 0.0;
	
	private double sideMaxodd = 0.0;
	private double sumMaxodd = 0.0;
	
	double maxdvalue = 0.0;
	
	int dvaluelimit = 1;
	
	int receiveDataInterval = 10;
	
	int notsamematchReceiveDataInterval = 10;
	
	int rebettime = 30;
	
	int delaybettime = 0;
	
	int refreshdelaybettime = 0;
	
	int betcountLimit = 1;
	
	int startBetGold = 0;
	
	int hgmaxbet = 100000;
	
	int bettimesLimit = 0;
	
	public int getBettimesLimit() {
		return bettimesLimit;
	}
	
	public int getNewBigBetAmount() {
		return newBigBetAmount;
	}
	
	public double getmaxdvalue() {
		return maxdvalue;
	}
	
	public int getdvaluelimit() {
		return dvaluelimit;
	}
	
	public double getSpecialMinRatio() {
		return specialMinRatio;
	}
	
	public double getNewBigMinRatio() {
		return newBigMinRatio;
	}
	
	public double getSpecialSecondMinRatio() {
		return specialSecondMinRatio;
	}
	

	public double getSpecialDXQMinRatio() {
		return specialDXQMinRatio;
	}

	
	public int getSpecialBetAmount() {
		return specialBetAmount;
	}

	public int getSpecialSecondBetAmount() {
		return specialSecondBetAmount;
	}

	
	public int getSpecialDXQBetAmount() {
		return specialDXQBetAmount;
	}
	
	public int getspecialBetInterval(){
		return specialBetInterval;
	}
	
	public int getspecialDXQMinBet() {
		return specialDXQMinBet;
	}
	
	public int getReceiveDataInterval() {
		return receiveDataInterval;
	}

	public int getnotsamematchReceiveDataInterval() {
		return notsamematchReceiveDataInterval;
	}
	
	public int getbetcountLimit() {
		return betcountLimit;
	}
	
	public int getstartBetGold() {
		return startBetGold;
	}

	public void setReceiveDataInterval(int receiveDataInterval) {
		this.receiveDataInterval = receiveDataInterval;
	}

	private int hgBetAmount = 0;
	private double ps38betRatio = 0.001;
	private double ps38betAmount = 300;
	private double betodd = 0.0;
	private boolean bps38betAmount = false;
	
	private boolean bmatchFilter = false;
	
	private boolean autoBet = false;
	
	private boolean betISN = false;
	
	private boolean betPS38 = false;
	private boolean betNewBig = false;
	
	private boolean betHalf = true;
	private boolean betWhole = true;
	
	private boolean newBigBetHalf = true;
	private boolean newBigBetWhole = false;
	
	private boolean ignoreWarn = false;
	
	private boolean ignoreRedcard = false;
	
	JCheckBox autoBetCheckBox = null;
	JCheckBox betISNCheckBox = null;
	JCheckBox betPS38CheckBox = null;
	JCheckBox betNewBigCheckBox = null;
	JCheckBox matchFilterCheckBox = null;
	
	JCheckBox ps38BetAmountCheckBox = null;
	
	JCheckBox betdanshiCheckBox = null;
	JCheckBox betrunningCheckBox = null;
	
	JCheckBox betpankouCheckBox = null;
	JCheckBox betdxqCheckBox = null;
	
	private boolean bbetdanshi = true;
	private boolean bbetrunning = true;
	
	private boolean bbetpankou = true;
	private boolean bbetdxq = true;
	
	JCheckBox betHalfCheckBox = null;
	JCheckBox betWholeCheckBox = null;
	
	JCheckBox newBigBetHalfCheckBox = null;
	JCheckBox newBigBetWholeCheckBox = null;
	
	JCheckBox ignoreWarnCheckBox = null;
	
	JCheckBox ignoreRedcardCheckBox = null;
	
	int manualBetSuccessTime = 10;
	
	public int getmanualBetSuccessTime() {
		return manualBetSuccessTime;
	}
	
	public boolean getBetHalf() {
		return false;
	}
	
	public boolean getNewBigBetHalf() {
		return newBigBetHalf;
	}
	
	public boolean getNewBigBetWhole() {
		return newBigBetWhole;
	}
	

	
	public int gethgmaxbet() {
		return hgmaxbet;
	}
	
	public boolean getBetWhole() {
		return betWhole;
	}
	
	public boolean getIgnoreWarn() {
		return ignoreWarn;
	}

	public boolean getIgnoreRedcard() {
		return ignoreRedcard;
	}

	
	
	public double getsideMin() {
		return sideMinodd;
	}
	
	public double getsumMin() {
		return sumMinodd;
	}
	
	
	public double getsideMax() {
		return sideMaxodd;
	}
	
	public double getsumMax() {
		return sumMaxodd;
	}
	
	public int getforbidst() {
		return forbidTimest;
	}
	
	public int getforbided() {
		return forbidTimeed;
	}
	
	public boolean getbetpankou() {
		return bbetpankou;
	}
	
	public boolean getbetdxq() {
		return bbetdxq;
	}
	
	public SettingPane() {
		setLayout(null);

		JLabel sideLb = new JLabel("过滤赔率低于");
		sideLb.setBounds(10, 171, 97, 26);
		add(sideLb);
		
		sideMinTextField = new JTextField();
		sideMinTextField.setBounds(110, 171, 66, 21);
		add(sideMinTextField);
		sideMinTextField.setColumns(10);
		
		JLabel sumLb = new JLabel("过滤对比赔率低于");
		sumLb.setBounds(227, 171, 122, 26);
		add(sumLb);
		
		sumMinTextField = new JTextField();
		sumMinTextField.setColumns(10);
		sumMinTextField.setBounds(359, 171, 66, 21);
		add(sumMinTextField);
		

		
		JLabel forbidlb = new JLabel("禁止投注时间");
		forbidlb.setBounds(550, 171, 122, 26);
		add(forbidlb);
		
		forbidTimeStTextField = new JTextField();
		forbidTimeStTextField.setColumns(10);
		forbidTimeStTextField.setBounds(650, 171, 66, 21);
		add(forbidTimeStTextField);
		
		
		JLabel forbidlb1 = new JLabel("至");
		forbidlb1.setBounds(720, 171, 30, 26);
		add(forbidlb1);
		
		forbidTimeEdTextField = new JTextField();
		forbidTimeEdTextField.setColumns(10);
		forbidTimeEdTextField.setBounds(750, 171, 66, 21);
		add(forbidTimeEdTextField);		
		
		

		
		JLabel label = new JLabel("过滤赔率高于");
		label.setBounds(10, 220, 97, 26);
		add(label);
		
		sideMaxTextField = new JTextField();
		sideMaxTextField.setColumns(10);
		sideMaxTextField.setBounds(110, 220, 66, 21);
		add(sideMaxTextField);
		
		JLabel label_1 = new JLabel("过滤对比赔率高于");
		label_1.setBounds(227, 220, 122, 26);
		add(label_1);
		
		sumMaxTextField = new JTextField();
		sumMaxTextField.setColumns(10);
		sumMaxTextField.setBounds(359, 220, 66, 21);
		add(sumMaxTextField);
		
		
		
		betdanshiCheckBox = new JCheckBox("投单式");
		betdanshiCheckBox.setBounds(459, 220, 100, 23);
		add(betdanshiCheckBox);

		

		betrunningCheckBox = new JCheckBox("投滚球");
		betrunningCheckBox.setBounds(559, 220, 100, 23);
		add(betrunningCheckBox);

		
		
		
		
		betpankouCheckBox = new JCheckBox("投让球");
		betpankouCheckBox.setBounds(659, 220, 100, 23);
		add(betpankouCheckBox);

		

		betdxqCheckBox = new JCheckBox("投大小");
		betdxqCheckBox.setBounds(759, 220, 100, 23);
		add(betdxqCheckBox);
		
		
		

		
		JLabel hgAmountLabel = new JLabel("皇冠金额：");
		hgAmountLabel.setBounds(10, 82, 97, 26);
		add(hgAmountLabel);
		
		hgAmountTextField = new JTextField();
		hgAmountTextField.setColumns(10);
		hgAmountTextField.setBounds(110, 85, 66, 21);
		add(hgAmountTextField);
		
		

		
		JLabel ps38AmountLabel = new JLabel("ps38金额：");
		ps38AmountLabel.setBounds(227, 82, 97, 26);
		add(ps38AmountLabel);
		
		ps38AmountTextField = new JTextField();
		ps38AmountTextField.setColumns(10);
		ps38AmountTextField.setBounds(318, 85, 66, 21);
		add(ps38AmountTextField);
		
		
		
		
		JLabel ps38PercentLabel = new JLabel("ps38比例：");
		ps38PercentLabel.setBounds(427, 82, 97, 26);
		//add(ps38PercentLabel);
		
		ps38PercentTextField = new JTextField();
		ps38PercentTextField.setColumns(10);
		ps38PercentTextField.setBounds(518, 85, 66, 21);
		//add(ps38PercentTextField);
		
		
		
		
		JLabel Label = new JLabel("皇冠最大投注：");
		Label.setBounds(427, 82, 97, 26);
		add(Label);
		
		hgMaxBetTextField = new JTextField();
		hgMaxBetTextField.setColumns(10);
		hgMaxBetTextField.setBounds(518, 85, 66, 21);
		add(hgMaxBetTextField);
		
		
		
		
		ps38BetAmountCheckBox = new JCheckBox("PS38按固定金额投注");
		ps38BetAmountCheckBox.setBounds(618, 85, 200, 23);
		add(ps38BetAmountCheckBox);
		

		
		JLabel hgintervalLabel = new JLabel("同场次收数据间隔(秒)");
		hgintervalLabel.setBounds(10, 112, 150, 26);
		add(hgintervalLabel);
		
		receiveDataIntervalField = new JTextField();
		receiveDataIntervalField.setColumns(10);
		receiveDataIntervalField.setBounds(150, 115, 66, 21);
		add(receiveDataIntervalField);
		
		
		
		JLabel hgintervalLabel1 = new JLabel("不同场次收数据间隔(秒)");
		hgintervalLabel1.setBounds(230, 112, 150, 26);
		add(hgintervalLabel1);
		
		receiveDataIntervalField1 = new JTextField();
		receiveDataIntervalField1.setColumns(10);
		receiveDataIntervalField1.setBounds(370, 115, 66, 21);
		add(receiveDataIntervalField1);
		
		
		
		
		
		JLabel label111 = new JLabel("手数限制");
		label111.setBounds(470, 112, 150, 26);
		add(label111);
		
		betlimitField = new JTextField();
		betlimitField.setColumns(10);
		betlimitField.setBounds(570, 115, 66, 21);
		add(betlimitField);
		
		
		
		JLabel label11 = new JLabel("起投金额");
		label11.setBounds(670, 112, 150, 26);
		add(label11);
		
		startBetGoldField = new JTextField();
		startBetGoldField.setColumns(10);
		startBetGoldField.setBounds(770, 115, 66, 21);
		add(startBetGoldField);
		
		
		
		
		JLabel label_2 = new JLabel("利润设置：");
		label_2.setBounds(10, 270, 97, 26);
		add(label_2);
		
		betoddTextField = new JTextField();
		betoddTextField.setColumns(10);
		betoddTextField.setBounds(78, 270, 66, 21);
		add(betoddTextField);
		

		
		JLabel label_3 = new JLabel("补单时间：");
		label_3.setBounds(200, 270, 97, 26);
		add(label_3);
		
		reBetTimeTextField = new JTextField();
		reBetTimeTextField.setColumns(10);
		reBetTimeTextField.setBounds(278, 270, 66, 21);
		add(reBetTimeTextField);
		
		
		JLabel label_4 = new JLabel("接受数据后投注延时");
		label_4.setBounds(360, 270, 150, 26);
		add(label_4);
		
		delayBetTimeTextField = new JTextField();
		delayBetTimeTextField.setColumns(10);
		delayBetTimeTextField.setBounds(478, 270, 66, 21);
		add(delayBetTimeTextField);
		
		
		
		
		JLabel label_5 = new JLabel("刷水后投注延(秒)");
		label_5.setBounds(578, 270, 130, 26);
		add(label_5);
		
		refreshDelayBetTimeTextField = new JTextField();
		refreshDelayBetTimeTextField.setColumns(10);
		refreshDelayBetTimeTextField.setBounds(680, 270, 66, 21);
		add(refreshDelayBetTimeTextField);
		
		
		
		
		JLabel label_6 = new JLabel("手动投注成功时间间隔(秒)");
		label_6.setBounds(578, 300, 160, 26);
		add(label_6);
		
		manualBetSuccessTimeTextField = new JTextField();
		manualBetSuccessTimeTextField.setColumns(10);
		manualBetSuccessTimeTextField.setBounds(770, 300, 66, 21);
		add(manualBetSuccessTimeTextField);
		
		
		//JPanel specialPane = new JPanel();
		//add(specialPane, BorderLayout.EAST);
		
		
		//special start 
		JLabel label_spe = new JLabel("特殊投注设置区域:");
		label_spe.setBounds(800, 20, 120, 26);
		add(label_spe);
		
		
		JLabel label_7 = new JLabel("盘口与初盘相差范围");
		label_7.setBounds(978, 50, 120, 26);
		add(label_7);

		maxdvalueTextField = new JTextField();
		maxdvalueTextField.setColumns(10);
		maxdvalueTextField.setBounds(1100, 50, 66, 21);
		add(maxdvalueTextField);
		
		
		
		
		JLabel label_8 = new JLabel("差值高亮手数");
		label_8.setBounds(978, 80, 100, 26);
		add(label_8);
		
		dvaluelimitTextField = new JTextField();
		dvaluelimitTextField.setColumns(10);
		dvaluelimitTextField.setBounds(1078, 80, 66, 21);
		add(dvaluelimitTextField);
		
		JLabel label_9 = new JLabel("让球投注最低水位");
		label_9.setBounds(978, 110, 120, 26);
		add(label_9);
		
		specialMinRatioTextField = new JTextField();
		specialMinRatioTextField.setColumns(10);
		specialMinRatioTextField.setBounds(1098, 110, 66, 21);
		add(specialMinRatioTextField);
		
		JLabel label_100 = new JLabel("让球投注金额");
		label_100.setBounds(978, 140, 120, 26);
		add(label_100);
		
		specialBetAmountTextField = new JTextField();
		specialBetAmountTextField.setColumns(10);
		specialBetAmountTextField.setBounds(1098, 140, 66, 21);
		add(specialBetAmountTextField);
		
		
		JLabel label_10 = new JLabel("第二手投注最低水位");
		label_10.setBounds(978, 170, 120, 26);
		add(label_10);
		
		specialSecondMinRatioTextField = new JTextField();
		specialSecondMinRatioTextField.setColumns(10);
		specialSecondMinRatioTextField.setBounds(1098, 170, 66, 21);
		add(specialSecondMinRatioTextField);
		
		
		JLabel label_11 = new JLabel("第二手投注金额");
		label_11.setBounds(978, 200, 120, 26);
		add(label_11);
		
		specialSecondBetAmountTextField = new JTextField();
		specialSecondBetAmountTextField.setColumns(10);
		specialSecondBetAmountTextField.setBounds(1098, 200, 66, 21);
		add(specialSecondBetAmountTextField);
		
		JLabel label_101 = new JLabel("特殊投注时间间隔");
		label_101.setBounds(978, 230, 120, 26);
		add(label_101);
		
		specialBetIntervalTextField = new JTextField();
		specialBetIntervalTextField.setColumns(10);
		specialBetIntervalTextField.setBounds(1098, 230, 66, 21);
		add(specialBetIntervalTextField);
		
		
		
		JLabel label_102 = new JLabel("大小球起投手数");
		label_102.setBounds(978, 260, 120, 26);
		add(label_102);
		
		specialDXQMinBetTextField = new JTextField();
		specialDXQMinBetTextField.setColumns(10);
		specialDXQMinBetTextField.setBounds(1098, 260, 66, 21);
		add(specialDXQMinBetTextField);
		
		
		
		JLabel label_103 = new JLabel("大小球投注金额");
		label_103.setBounds(978, 290, 120, 26);
		add(label_103);
		
		
		specialDXQBetAmountTextField = new JTextField();
		specialDXQBetAmountTextField.setColumns(10);
		specialDXQBetAmountTextField.setBounds(1098, 290, 66, 21);
		add(specialDXQBetAmountTextField);
		
		
		JLabel label_104 = new JLabel("大小球投注最低水位");
		label_104.setBounds(978, 320, 120, 26);
		add(label_104);
		
		specialDXQMinRatioTextField = new JTextField();
		specialDXQMinRatioTextField.setColumns(10);
		specialDXQMinRatioTextField.setBounds(1098, 320, 66, 21);
		add(specialDXQMinRatioTextField);

		JLabel label_105 = new JLabel("投注手数限制");
		label_105.setBounds(978, 350, 120, 26);
		add(label_105);
		
		bettimesLimitTextField = new JTextField();
		bettimesLimitTextField.setColumns(10);
		bettimesLimitTextField.setBounds(1098, 350, 66, 21);
		add(bettimesLimitTextField);
		
		
		betISNCheckBox = new JCheckBox("投注皇冠");
		betISNCheckBox.setBounds(978, 370, 120, 26);
		add(betISNCheckBox);
		
		betPS38CheckBox = new JCheckBox("投注ISN、平博");
		betPS38CheckBox.setBounds(978, 390, 120, 26);
		add(betPS38CheckBox);
		
		betNewBigCheckBox = new JCheckBox("投新大小");
		betNewBigCheckBox.setBounds(978, 410, 120, 26);
		add(betNewBigCheckBox);	
		
		
		
		JLabel label_10001 = new JLabel("新大小投注金额");
		label_10001.setBounds(978, 430, 120, 26);
		add(label_10001);
		
		newBigBetAmountTextField = new JTextField();
		newBigBetAmountTextField.setColumns(10);
		newBigBetAmountTextField.setBounds(1098, 430, 66, 21);
		add(newBigBetAmountTextField);
		
		newBigBetHalfCheckBox = new JCheckBox("新大小投半场 ");
		newBigBetHalfCheckBox.setBounds(978, 450, 123, 23);
		add(newBigBetHalfCheckBox);
		
		newBigBetWholeCheckBox = new JCheckBox("投全场");
		newBigBetWholeCheckBox.setBounds(1098, 450, 103, 23);
		add(newBigBetWholeCheckBox);
		
		
		JLabel label_10002 = new JLabel("新大小投注最低水位");
		label_10002.setBounds(978, 470, 120, 26);
		add(label_10002);
		
		newBigMinRatioTextField = new JTextField();
		newBigMinRatioTextField.setColumns(10);
		newBigMinRatioTextField.setBounds(1098, 470, 66, 21);
		add(newBigMinRatioTextField);

		
		
		
		//special end
		
		
		
		autoBetCheckBox = new JCheckBox("自动投注");
		autoBetCheckBox.setBounds(4, 330, 103, 23);
		add(autoBetCheckBox);
		
		matchFilterCheckBox = new JCheckBox("过滤对头单");
		matchFilterCheckBox.setBounds(104, 330, 103, 23);
		add(matchFilterCheckBox);
		
		
		
		betHalfCheckBox = new JCheckBox("投半场 ");
		betHalfCheckBox.setBounds(4, 390, 103, 23);
		add(betHalfCheckBox);
		
		betWholeCheckBox = new JCheckBox("投全场");
		betWholeCheckBox.setBounds(104, 390, 103, 23);
		add(betWholeCheckBox);
		
		ignoreWarnCheckBox = new JCheckBox("忽略非投警告 ");
		ignoreWarnCheckBox.setBounds(4, 450, 103, 23);
		add(ignoreWarnCheckBox);
		
		
		ignoreRedcardCheckBox = new JCheckBox("忽略红牌 ");
		ignoreRedcardCheckBox.setBounds(124, 450, 103, 23);
		add(ignoreRedcardCheckBox);
		
		
		autoBetCheckBox.addItemListener(new ItemListener() {


			@Override
			public void itemStateChanged(ItemEvent e) {
				// TODO Auto-generated method stub
               // int index = jcb.getSelectedIndex();
				if(e.getStateChange() == ItemEvent.DESELECTED){
					autoBet = false;
				}else{
					autoBet = true;
				}
				
				
			}
        });
		
		betISNCheckBox.addItemListener(new ItemListener() {


			@Override
			public void itemStateChanged(ItemEvent e) {
				// TODO Auto-generated method stub
               // int index = jcb.getSelectedIndex();
				if(e.getStateChange() == ItemEvent.DESELECTED){
					betISN = false;
				}else{
					betISN = true;
				}
				
				
			}
        });
		
		betPS38CheckBox.addItemListener(new ItemListener() {


			@Override
			public void itemStateChanged(ItemEvent e) {
				// TODO Auto-generated method stub
               // int index = jcb.getSelectedIndex();
				if(e.getStateChange() == ItemEvent.DESELECTED){
					betPS38 = false;
				}else{
					betPS38 = true;
				}
				
				
			}
        });
		
		betNewBigCheckBox.addItemListener(new ItemListener() {


			@Override
			public void itemStateChanged(ItemEvent e) {
				// TODO Auto-generated method stub
               // int index = jcb.getSelectedIndex();
				if(e.getStateChange() == ItemEvent.DESELECTED){
					betNewBig = false;
				}else{
					betNewBig = true;
				}
				
				
			}
        });
		
		
		betHalfCheckBox.addItemListener(new ItemListener() {


			@Override
			public void itemStateChanged(ItemEvent e) {
				// TODO Auto-generated method stub
               // int index = jcb.getSelectedIndex();
				if(e.getStateChange() == ItemEvent.DESELECTED){
					betHalf = false;
				}else{
					betHalf = true;
				}
				
				
			}
			
			
        });
		
		newBigBetHalfCheckBox.addItemListener(new ItemListener() {


			@Override
			public void itemStateChanged(ItemEvent e) {
				// TODO Auto-generated method stub
               // int index = jcb.getSelectedIndex();
				if(e.getStateChange() == ItemEvent.DESELECTED){
					newBigBetHalf = false;
				}else{
					newBigBetHalf = true;
				}
				
				
			}
			
			
        });
		
		
		ignoreWarnCheckBox.addItemListener(new ItemListener() {


			@Override
			public void itemStateChanged(ItemEvent e) {
				// TODO Auto-generated method stub
               // int index = jcb.getSelectedIndex();
				if(e.getStateChange() == ItemEvent.DESELECTED){
					ignoreWarn = false;
				}else{
					ignoreWarn = true;
				}
				
				
			}
			
			
        });
		
		ignoreRedcardCheckBox.addItemListener(new ItemListener() {


			@Override
			public void itemStateChanged(ItemEvent e) {
				// TODO Auto-generated method stub
               // int index = jcb.getSelectedIndex();
				if(e.getStateChange() == ItemEvent.DESELECTED){
					ignoreRedcard = false;
				}else{
					ignoreRedcard = true;
				}
				
				
			}
			
			
        });
		
		
		
		
		betWholeCheckBox.addItemListener(new ItemListener() {


			@Override
			public void itemStateChanged(ItemEvent e) {
				// TODO Auto-generated method stub
               // int index = jcb.getSelectedIndex();
				if(e.getStateChange() == ItemEvent.DESELECTED){
					betWhole = false;
				}else{
					betWhole = true;
				}
				
				
			}
        });
		
		
		newBigBetWholeCheckBox.addItemListener(new ItemListener() {


			@Override
			public void itemStateChanged(ItemEvent e) {
				// TODO Auto-generated method stub
               // int index = jcb.getSelectedIndex();
				if(e.getStateChange() == ItemEvent.DESELECTED){
					newBigBetWhole = false;
				}else{
					newBigBetWhole = true;
				}
				
				
			}
        });
		
		
		ps38BetAmountCheckBox.addItemListener(new ItemListener() {


			@Override
			public void itemStateChanged(ItemEvent e) {
				// TODO Auto-generated method stub
               // int index = jcb.getSelectedIndex();
				if(e.getStateChange() == ItemEvent.DESELECTED){
					bps38betAmount = false;
				}else{
					bps38betAmount = true;
				}
				
				
			}
        });
		
		
		betdanshiCheckBox.addItemListener(new ItemListener() {


			@Override
			public void itemStateChanged(ItemEvent e) {
				// TODO Auto-generated method stub
               // int index = jcb.getSelectedIndex();
				if(e.getStateChange() == ItemEvent.DESELECTED){
					bbetdanshi = false;
				}else{
					bbetdanshi = true;
				}
				
				
			}
        });
		
		betrunningCheckBox.addItemListener(new ItemListener() {


			@Override
			public void itemStateChanged(ItemEvent e) {
				// TODO Auto-generated method stub
               // int index = jcb.getSelectedIndex();
				if(e.getStateChange() == ItemEvent.DESELECTED){
					bbetrunning = false;
				}else{
					bbetrunning = true;
				}
				
				
			}
        });
		
		
		betpankouCheckBox.addItemListener(new ItemListener() {


			@Override
			public void itemStateChanged(ItemEvent e) {
				// TODO Auto-generated method stub
               // int index = jcb.getSelectedIndex();
				if(e.getStateChange() == ItemEvent.DESELECTED){
					bbetpankou = false;
				}else{
					bbetpankou = true;
				}
				
				
			}
        });
		
		
		
		betdxqCheckBox.addItemListener(new ItemListener() {


			@Override
			public void itemStateChanged(ItemEvent e) {
				// TODO Auto-generated method stub
               // int index = jcb.getSelectedIndex();
				if(e.getStateChange() == ItemEvent.DESELECTED){
					bbetdxq = false;
				}else{
					bbetdxq = true;
				}
				
				
			}
        });
		
		
		matchFilterCheckBox.addItemListener(new ItemListener() {


			@Override
			public void itemStateChanged(ItemEvent e) {
				// TODO Auto-generated method stub
               // int index = jcb.getSelectedIndex();
				if(e.getStateChange() == ItemEvent.DESELECTED){
					bmatchFilter = false;
				}else{
					bmatchFilter = true;
				}
				
				
			}
        });
		
		
		JButton saveButton = new JButton("保存设置");
		saveButton.setBounds(295, 330, 145, 48);
		add(saveButton);
		
		
		saveButton.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				
				
				
				String str = sideMinTextField.getText();
				if(!Common.isNum(str)) {
					JOptionPane.showMessageDialog(null,"过滤赔率低于输入不正确");
					return;
				}
				
				str = sumMinTextField.getText();
				
				if(!Common.isNum(str)) {
					JOptionPane.showMessageDialog(null,"过滤对比赔率低于输入不正确");
					return;
				}
				
				str = sideMaxTextField.getText();
				
				if(!Common.isNum(str)) {
					JOptionPane.showMessageDialog(null,"过滤赔率高于输入不正确");
					return;
				}
				
				
				str = sumMaxTextField.getText();
				
				if(!Common.isNum(str)) {
					JOptionPane.showMessageDialog(null,"过滤对比赔率高于输入不正确");
					return;
				}
				
				
				
				
				str = hgAmountTextField.getText();
				if(!Common.isNum(str)) {
					JOptionPane.showMessageDialog(null,"请输入皇冠正确投注金额");
					return;
				}
				
				str = ps38AmountTextField.getText();
				
				if(!Common.isNum(str)) {
					JOptionPane.showMessageDialog(null,"请输入正确的投注金额");
					return;
				}
				
				
				str = ps38PercentTextField.getText();
				
				if(!Common.isNum(str)) {
					JOptionPane.showMessageDialog(null,"请输入正确的投注比例");
					return;
				}
				
				
				str = betoddTextField.getText();
				
				if(!Common.isNum(str)) {
					JOptionPane.showMessageDialog(null,"请输入正确的利润设置");
					return;
				}
				
				
				
				str = reBetTimeTextField.getText();
				
				if(!Common.isNum(str)) {
					JOptionPane.showMessageDialog(null,"请输入正确的补单时间");
					return;
				}
				
				
				
				str = delayBetTimeTextField.getText();
				
				if(!Common.isNum(str)) {
					JOptionPane.showMessageDialog(null,"请输入正确的投注延时");
					return;
				}
				
				
				str = refreshDelayBetTimeTextField.getText();
				
				if(!Common.isNum(str)) {
					JOptionPane.showMessageDialog(null,"请输入正确的刷水后投注延时");
					return;
				}
				
				str = manualBetSuccessTimeTextField.getText();
				
				
				
				
				
				
				
				if(!Common.isNum(str)) {
					JOptionPane.showMessageDialog(null,"请输入正确的手动投注成功间隔时间");
					return;
				}
				
				
				str = maxdvalueTextField.getText();
				
				if(!Common.isNum(str)) {
					JOptionPane.showMessageDialog(null,"请输入正确的盘口相差范围");
					return;
				}
				
				str = dvaluelimitTextField.getText();
				
				if(!Common.isNum(str)) {
					JOptionPane.showMessageDialog(null,"请输入正确的手数差值过滤");
					return;
				}
				
				str = specialMinRatioTextField.getText();
				
				if(!Common.isNum(str)) {
					JOptionPane.showMessageDialog(null, "请输入正确的特殊投注最低水位值");
				}
				
				str = newBigMinRatioTextField.getText();
				
				if(!Common.isNum(str)) {
					JOptionPane.showMessageDialog(null, "请输入正确的新大小最低水位值");
				}
				
				str = specialSecondMinRatioTextField.getText();
				
				if(!Common.isNum(str)) {
					JOptionPane.showMessageDialog(null, "请输入正确的第二手投注最低水位值");
				}
				
				str = specialDXQMinRatioTextField.getText();
				
				if(!Common.isNum(str)) {
					JOptionPane.showMessageDialog(null, "请输入正确的特殊大小球投注最低水位值");
				}
				
				
				
				str = bettimesLimitTextField.getText();
				
				if(!Common.isNum(str)) {
					JOptionPane.showMessageDialog(null, "请输入正确的投注手数限制");
				}
				
				
				
				str = newBigBetAmountTextField.getText();
				
				if(!Common.isNum(str)) {
					JOptionPane.showMessageDialog(null, "请输入新大小投注金额");
				}
				
				str = specialBetAmountTextField.getText();
				
				if(!Common.isNum(str)) {
					JOptionPane.showMessageDialog(null, "请输入正确的特殊投注金额");
				}
				
				str = specialSecondBetAmountTextField.getText();
				
				if(!Common.isNum(str)) {
					JOptionPane.showMessageDialog(null, "请输入正确的第二手投注金额");
				}
				
				str = specialDXQBetAmountTextField.getText();
				
				if(!Common.isNum(str)) {
					JOptionPane.showMessageDialog(null, "请输入正确的特殊大小球投注金额");
				}
				
				
				str = specialBetIntervalTextField.getText();
				
				if(!Common.isNum(str)) {
					JOptionPane.showMessageDialog(null, "请输入正确的特殊投注金额");
				}
				
				str = specialDXQMinBetTextField.getText();
				if(!Common.isNum(str)) {
					JOptionPane.showMessageDialog(null, "请输入正确的大小球起投手数");
				}
				
				
				
				str = receiveDataIntervalField.getText();
				
				if(!Common.isNum(str)) {
					JOptionPane.showMessageDialog(null,"请输入正确同场次收数据间隔时间");
					return;
				}
				
				
				str = receiveDataIntervalField1.getText();
				
				if(!Common.isNum(str)) {
					JOptionPane.showMessageDialog(null,"请输入正确不同场次收数据间隔时间");
					return;
				}
				
				
				str = betlimitField.getText();
				
				if(!Common.isNum(str)) {
					JOptionPane.showMessageDialog(null,"请输入正确的手数限制");
					return;
				}
				
				str = startBetGoldField.getText();
				
				if(!Common.isNum(str)) {
					JOptionPane.showMessageDialog(null,"请输入正确的起投金额");
					return;
				}
				
				
				str = forbidTimeStTextField.getText();
				
				if(!Common.isNum(str)) {
					JOptionPane.showMessageDialog(null,"请输入正确的禁止投注时间");
					return;
				}

				str = forbidTimeEdTextField.getText();
				
				if(!Common.isNum(str)) {
					JOptionPane.showMessageDialog(null,"请输入正确的禁止投注时间");
					return;
				}				
				
				
				str = hgMaxBetTextField.getText();
				
				if(!Common.isNum(str)) {
					JOptionPane.showMessageDialog(null,"请输入正确的皇冠最大投注金额");
					return;
				}
				
				
				if(savebetparamstofile()) {
					JOptionPane.showMessageDialog(null,"保存设置成功");
					
					
					
					sideMinodd = Double.parseDouble(sideMinTextField.getText());
					sumMinodd = Double.parseDouble(sumMinTextField.getText());
					sideMaxodd = Double.parseDouble(sideMaxTextField.getText());
					sumMaxodd = Double.parseDouble(sumMaxTextField.getText());
					
					
					
					hgBetAmount = Integer.parseInt(hgAmountTextField.getText());
					ps38betRatio = Double.parseDouble(ps38PercentTextField.getText());
					ps38betAmount = Double.parseDouble(ps38AmountTextField.getText());
					betodd = Double.parseDouble(betoddTextField.getText());
					
					rebettime = Integer.parseInt(reBetTimeTextField.getText());
					
					
					delaybettime = Integer.parseInt(delayBetTimeTextField.getText());
					
					refreshdelaybettime = Integer.parseInt(refreshDelayBetTimeTextField.getText());
					
					manualBetSuccessTime = Integer.parseInt(manualBetSuccessTimeTextField.getText());
					
					maxdvalue = Double.parseDouble(maxdvalueTextField.getText());
					
					
					dvaluelimit = Integer.parseInt(dvaluelimitTextField.getText());
					
					specialMinRatio = Double.parseDouble(specialMinRatioTextField.getText());
					
					newBigMinRatio = Double.parseDouble(newBigMinRatioTextField.getText());
					
					specialSecondMinRatio = Double.parseDouble(specialSecondMinRatioTextField.getText());
					
					specialDXQMinRatio = Double.parseDouble(specialDXQMinRatioTextField.getText());
					
					bettimesLimit = Integer.parseInt(bettimesLimitTextField.getText());
					
					newBigBetAmount = Integer.parseInt(newBigBetAmountTextField.getText());
										
					specialBetAmount = Integer.parseInt(specialBetAmountTextField.getText());
					
					specialSecondBetAmount = Integer.parseInt(specialSecondBetAmountTextField.getText());
					
					specialDXQBetAmount = Integer.parseInt(specialDXQBetAmountTextField.getText());

					specialBetInterval = Integer.parseInt(specialBetIntervalTextField.getText());
					
					specialDXQMinBet = Integer.parseInt(specialDXQMinBetTextField.getText());

					receiveDataInterval = Integer.parseInt(receiveDataIntervalField.getText());
					
					notsamematchReceiveDataInterval = Integer.parseInt(receiveDataIntervalField1.getText());
					
					betcountLimit = Integer.parseInt(betlimitField.getText());
					
					startBetGold = Integer.parseInt(startBetGoldField.getText());
					
					hgmaxbet = Integer.parseInt(hgMaxBetTextField.getText());
					
					
					forbidTimest = Integer.parseInt(forbidTimeStTextField.getText());
					forbidTimeed = Integer.parseInt(forbidTimeEdTextField.getText());
					
					
					if(BetClient.betCtrMng != null) {
						BetClient.betCtrMng.updateBetAdyTable();
					}
					
					
					
				}else {
					JOptionPane.showMessageDialog(null,"保存设置失败");
					
					
				}
				
			}
		});
		
		
		recoverbetparamsfromfile();

	}
	


	
	public int gethgBetAmount() {
		return hgBetAmount;
	}
	

	public double getps38betRatio() {
		return ps38betRatio;
	}
	
	public double getps38betAmount() {
		return ps38betAmount;
	}

	public double getbetodd() {
		return betodd;
	}
	
	public boolean getbetdanshi() {
		return bbetdanshi;
	}
	
	public boolean getbetrunning() {
		return bbetrunning;
	}
	
	public boolean getAutoBet() {
		return autoBet;
	}
	
	public boolean getBetISN() {
		return betISN;
	}
	
	public boolean getBetPS38() {
		return betPS38;
	}
	
	public boolean getBetNewBig() {
		return betNewBig;
	}
	
	public boolean getMatchFilter() {
		return bmatchFilter;
	}
	
	public boolean getbp38BetAmount() {
		return bps38betAmount;
	}
	

	public int getrebettime() {
		return rebettime;
	}
	
	
	public int getdelaybettime() {
		return delaybettime;
	}
	
	public int getrefreshdelaybettime() {
		return refreshdelaybettime;
	}
	
	public void recoverbetparamsfromfile(){
		try{
			
			File file = new File("data" + "/sesttingparams.txt");
			
			if(!file.exists()){
				return;
			}

			BufferedReader freader = new BufferedReader(new InputStreamReader(new FileInputStream(file), "UTF-8"));
			
			
			
			
			
			String str = "";
			
			int linenum = 0;

			while ((str = freader.readLine()) != null) {
				

				

				if(linenum == 0) {
					
					if(Common.isNum(str)) {
						hgBetAmount = Integer.parseInt(str);
						hgAmountTextField.setText(str);
					}

				}else if(linenum == 1) {
					if(Common.isNum(str)) {
						ps38betAmount = Double.parseDouble(str);
						ps38AmountTextField.setText(str);
					}
				}else if(linenum == 2) {
					if(Common.isNum(str)) {
						ps38betRatio = Double.parseDouble(str);
						ps38PercentTextField.setText(str);
					}
				}else if(linenum == 3) {
					
						bps38betAmount = Boolean.parseBoolean(str);
						ps38BetAmountCheckBox.setSelected(bps38betAmount);
					
				}else if(linenum == 4) {
					if(Common.isNum(str)) {
						betodd = Double.parseDouble(str);
						betoddTextField.setText(str);
					}
				}else if(linenum == 5) {
					autoBet = Boolean.parseBoolean(str);
					autoBetCheckBox.setSelected(autoBet);
				}else if(linenum == 6) {
					bmatchFilter = Boolean.parseBoolean(str);
					matchFilterCheckBox.setSelected(bmatchFilter);
				}else if(linenum == 7) {
					receiveDataInterval = Integer.parseInt(str);
					receiveDataIntervalField.setText(str);
				}else if(linenum == 8) {
					if(Common.isNum(str)) {
						sideMinodd = Double.parseDouble(str);
						sideMinTextField.setText(str);
					}
				}else if(linenum == 9) {
					if(Common.isNum(str)) {
						sumMinodd = Double.parseDouble(str);
						sumMinTextField.setText(str);
					}
				}else if(linenum ==10) {
					if(Common.isNum(str)) {
						sideMaxodd = Double.parseDouble(str);
						sideMaxTextField.setText(str);
					}
				}else if(linenum == 11) {
					if(Common.isNum(str)) {
						sumMaxodd = Double.parseDouble(str);
						sumMaxTextField.setText(str);
					}
				}else if(linenum == 12) {
					betHalf = Boolean.parseBoolean(str);
					betHalfCheckBox.setSelected(betHalf);
				}else if(linenum == 13) {
					betWhole = Boolean.parseBoolean(str);
					betWholeCheckBox.setSelected(betWhole);
				}else if(linenum == 14) {
					notsamematchReceiveDataInterval = Integer.parseInt(str);
					receiveDataIntervalField1.setText(str);
				}else if(linenum == 15) {
					ignoreWarn = Boolean.parseBoolean(str);
					ignoreWarnCheckBox.setSelected(ignoreWarn);
				}else if(linenum == 16) {
					if(Common.isNum(str)) {
						rebettime = Integer.parseInt(str);
						reBetTimeTextField.setText(str);
					}
				}else if(linenum == 17) {
					if(Common.isNum(str)) {
						delaybettime = Integer.parseInt(str);
						delayBetTimeTextField.setText(str);
					}
				}else if(linenum == 18) {
					betcountLimit = Integer.parseInt(str);
					betlimitField.setText(str);
				}else if(linenum == 19) {
					startBetGold = Integer.parseInt(str);
					startBetGoldField.setText(str);
				}else if(linenum == 20) {
					hgmaxbet = Integer.parseInt(str);
					hgMaxBetTextField.setText(str);
				}else if(linenum == 21) {
					forbidTimest = Integer.parseInt(str);
					forbidTimeStTextField.setText(str);
				}else if(linenum == 22) {
					forbidTimeed = Integer.parseInt(str);
					forbidTimeEdTextField.setText(str);
				}else if(linenum == 23) {
					bbetdanshi = Boolean.parseBoolean(str);
					betdanshiCheckBox.setSelected(bbetdanshi);
				}else if(linenum == 24) {
						bbetrunning = Boolean.parseBoolean(str);
						betrunningCheckBox.setSelected(bbetrunning);
				}else if(linenum == 25) {
					bbetpankou = Boolean.parseBoolean(str);
					betpankouCheckBox.setSelected(bbetpankou);
				}else if(linenum == 26) {
						bbetdxq = Boolean.parseBoolean(str);
						betdxqCheckBox.setSelected(bbetdxq);
				}else if(linenum == 27) {
					if(Common.isNum(str)) {
						refreshdelaybettime = Integer.parseInt(str);
						refreshDelayBetTimeTextField.setText(str);
					}
				}else if(linenum == 28) {
					if(Common.isNum(str)) {
						manualBetSuccessTime = Integer.parseInt(str);
						manualBetSuccessTimeTextField.setText(str);
					}
				}else if(linenum == 29) {
					if(Common.isNum(str)) {
						maxdvalue = Double.parseDouble(str);
						maxdvalueTextField.setText(str);
					}
				}else if(linenum == 30) {
					if(Common.isNum(str)) {
						dvaluelimit = Integer.parseInt(str);
						dvaluelimitTextField.setText(str);
					}
				}else if(linenum == 31) {
					if(Common.isNum(str)) {
						specialMinRatio = Double.parseDouble(str);
						specialMinRatioTextField.setText(str);
					}
				}else if(linenum == 32) {
					if(Common.isNum(str)) {
						specialBetAmount = Integer.parseInt(str);
						specialBetAmountTextField.setText(str);
					}
				}else if(linenum == 33) {
					if(Common.isNum(str)) {
						specialBetInterval = Integer.parseInt(str);
						specialBetIntervalTextField.setText(str);
					}
				}else if(linenum == 34) {
					if(Common.isNum(str)) {
						specialDXQMinBet = Integer.parseInt(str);
						specialDXQMinBetTextField.setText(str);
					}
				}else if(linenum == 35) {
					if(Common.isNum(str)) {
						specialDXQBetAmount = Integer.parseInt(str);
						specialDXQBetAmountTextField.setText(str);
					}
				}else if(linenum == 36) {
					if(Common.isNum(str)) {
						specialDXQMinRatio = Double.parseDouble(str);
						specialDXQMinRatioTextField.setText(str);
					}
				}else if(linenum == 37) {
					if(Common.isNum(str)) {
						specialSecondMinRatio = Double.parseDouble(str);
						specialSecondMinRatioTextField.setText(str);
					}
				}else if(linenum == 38) {
					if(Common.isNum(str)) {
						specialSecondBetAmount = Integer.parseInt(str);
						specialSecondBetAmountTextField.setText(str);
					}
				}else if(linenum == 39) {
					betISN = Boolean.parseBoolean(str);
					betISNCheckBox.setSelected(betISN);
				}else if(linenum == 40) {
					betPS38 = Boolean.parseBoolean(str);
					betPS38CheckBox.setSelected(betPS38);
				}else if(linenum == 41) {
					bettimesLimit = Integer.parseInt(str);
					bettimesLimitTextField.setText(str);
				}else if(linenum == 42) {
					betNewBig = Boolean.parseBoolean(str);
					betNewBigCheckBox.setSelected(betNewBig);
				}else if(linenum == 43) {
					newBigBetAmount = Integer.parseInt(str);
					newBigBetAmountTextField.setText(str);
				}else if(linenum == 44) {
					newBigBetHalf = Boolean.parseBoolean(str);
					newBigBetHalfCheckBox.setSelected(newBigBetHalf);
				}else if(linenum == 45) {
					newBigBetWhole = Boolean.parseBoolean(str);
					newBigBetWholeCheckBox.setSelected(newBigBetWhole);
				}else if(linenum == 46) {
					if(Common.isNum(str)) {
						newBigMinRatio = Double.parseDouble(str);
						newBigMinRatioTextField.setText(str);
					}
				}else if(linenum == 47) {
					ignoreRedcard = Boolean.parseBoolean(str);
					ignoreRedcardCheckBox.setSelected(ignoreRedcard);
				}
				
				
				
						
				
				
				linenum++;

			}
			
			
			
			
			if(null != freader){
				freader.close();
			}
			
		}catch(Exception e){
			e.printStackTrace();
		}
	}
	
	
	public boolean savebetparamstofile(){
		try{
			
			File filefolder = new File("data/");
			
			if(!filefolder.exists()){
				filefolder.mkdir();
			}
			
			File file = new File("data/"+ "sesttingparams.txt");

			if(!file.exists()){	
				file.createNewFile();
			}
			
			BufferedWriter fwlocal = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(file, false), "UTF-8"));

			
			
				
			
			String str = hgAmountTextField.getText();
			
			fwlocal.append(str);
			fwlocal.newLine();
			fwlocal.flush();
			
			
			str = ps38AmountTextField.getText();
			
			fwlocal.append(str);
			fwlocal.newLine();
			fwlocal.flush();
			
			
			str = ps38PercentTextField.getText();
			
			fwlocal.append(str);
			fwlocal.newLine();
			fwlocal.flush();
			
			
			str = Boolean.toString(ps38BetAmountCheckBox.isSelected());
			
			fwlocal.append(str);
			fwlocal.newLine();
			fwlocal.flush();
			
			
			str = betoddTextField.getText();
			
			fwlocal.append(str);
			fwlocal.newLine();
			fwlocal.flush();
			
			
			str = Boolean.toString(autoBetCheckBox.isSelected());
			
			fwlocal.append(str);
			fwlocal.newLine();
			fwlocal.flush();
			
			
			
			str = Boolean.toString(matchFilterCheckBox.isSelected());
			
			fwlocal.append(str);
			fwlocal.newLine();
			fwlocal.flush();
			
			
			
			str = receiveDataIntervalField.getText();

			fwlocal.append(str);
			fwlocal.newLine();
			fwlocal.flush();

			
	
			
			str = sideMinTextField.getText();
			
			fwlocal.append(str);
			fwlocal.newLine();
			fwlocal.flush();
			
			
			str = sumMinTextField.getText();
			
			fwlocal.append(str);
			fwlocal.newLine();
			fwlocal.flush();
			
			str = sideMaxTextField.getText();
			
			fwlocal.append(str);
			fwlocal.newLine();
			fwlocal.flush();
			
			str = sumMaxTextField.getText();
			
			fwlocal.append(str);
			fwlocal.newLine();
			fwlocal.flush();

			
			str = Boolean.toString(betHalfCheckBox.isSelected());
			
			fwlocal.append(str);
			fwlocal.newLine();
			fwlocal.flush();
			
			
			str = Boolean.toString(betWholeCheckBox.isSelected());
			
			fwlocal.append(str);
			fwlocal.newLine();
			fwlocal.flush();
			
			
			str = receiveDataIntervalField1.getText();

			fwlocal.append(str);
			fwlocal.newLine();
			fwlocal.flush();
			
			
			str = Boolean.toString(ignoreWarnCheckBox.isSelected());
			
			fwlocal.append(str);
			fwlocal.newLine();
			fwlocal.flush();
			
			
			str = reBetTimeTextField.getText();
			
			fwlocal.append(str);
			fwlocal.newLine();
			fwlocal.flush();
			
			str = delayBetTimeTextField.getText();
			
			fwlocal.append(str);
			fwlocal.newLine();
			fwlocal.flush();
			
			
			str = betlimitField.getText();
			
			fwlocal.append(str);
			fwlocal.newLine();
			fwlocal.flush();
			
			str = startBetGoldField.getText();
			
			fwlocal.append(str);
			fwlocal.newLine();
			fwlocal.flush();
			
			str = hgMaxBetTextField.getText();
			
			fwlocal.append(str);
			fwlocal.newLine();
			fwlocal.flush();	
			
			
			
			str = forbidTimeStTextField.getText();
			
			fwlocal.append(str);
			fwlocal.newLine();
			fwlocal.flush();	
			
			str = forbidTimeEdTextField.getText();
			
			fwlocal.append(str);
			fwlocal.newLine();
			fwlocal.flush();	
			
			
			
			str = Boolean.toString(betdanshiCheckBox.isSelected());
			
			fwlocal.append(str);
			fwlocal.newLine();
			fwlocal.flush();
			
			str = Boolean.toString(betrunningCheckBox.isSelected());
			
			fwlocal.append(str);
			fwlocal.newLine();
			fwlocal.flush();
			
			
			
			str = Boolean.toString(betpankouCheckBox.isSelected());
			
			fwlocal.append(str);
			fwlocal.newLine();
			fwlocal.flush();
			
			str = Boolean.toString(betdxqCheckBox.isSelected());
			
			fwlocal.append(str);
			fwlocal.newLine();
			fwlocal.flush();
			
			
			
			str = refreshDelayBetTimeTextField.getText();
			
			fwlocal.append(str);
			fwlocal.newLine();
			fwlocal.flush();
			
			
			
			str = manualBetSuccessTimeTextField.getText();
			
			fwlocal.append(str);
			fwlocal.newLine();
			fwlocal.flush();
			
			str = maxdvalueTextField.getText();
			fwlocal.append(str);
			fwlocal.newLine();
			fwlocal.flush();
			
			
			str = dvaluelimitTextField.getText();
			
			fwlocal.append(str);
			fwlocal.newLine();
			fwlocal.flush();
			
			str = specialMinRatioTextField.getText();
			
			fwlocal.append(str);
			fwlocal.newLine();
			fwlocal.flush();
			
			str = specialBetAmountTextField.getText();
			
			fwlocal.append(str);
			fwlocal.newLine();
			fwlocal.flush();
			
			str = specialBetIntervalTextField.getText();
			
			fwlocal.append(str);
			fwlocal.newLine();
			fwlocal.flush();
			
			
			str = specialDXQMinBetTextField.getText();
			fwlocal.append(str);
			fwlocal.newLine();
			fwlocal.flush();
			
			str = specialDXQBetAmountTextField.getText();
			
			fwlocal.append(str);
			fwlocal.newLine();
			fwlocal.flush();
			
			str = specialDXQMinRatioTextField.getText();
			
			fwlocal.append(str);
			fwlocal.newLine();
			fwlocal.flush();
			
			str = specialSecondMinRatioTextField.getText();
			
			fwlocal.append(str);
			fwlocal.newLine();
			fwlocal.flush();
			
			str = specialSecondBetAmountTextField.getText();
			
			fwlocal.append(str);
			fwlocal.newLine();
			fwlocal.flush();
			
			str = Boolean.toString(betISNCheckBox.isSelected());
			
			fwlocal.append(str);
			fwlocal.newLine();
			fwlocal.flush();
			
			str = Boolean.toString(betPS38CheckBox.isSelected());
			
			fwlocal.append(str);
			fwlocal.newLine();
			fwlocal.flush();
			
			
			
			str = bettimesLimitTextField.getText();
			
			fwlocal.append(str);
			fwlocal.newLine();
			fwlocal.flush();
			
			str = Boolean.toString(betNewBigCheckBox.isSelected());
			
			fwlocal.append(str);
			fwlocal.newLine();
			fwlocal.flush();
			
			str = newBigBetAmountTextField.getText();
			
			fwlocal.append(str);
			fwlocal.newLine();
			fwlocal.flush();
			
			
			str = Boolean.toString(newBigBetHalfCheckBox.isSelected());
			
			fwlocal.append(str);
			fwlocal.newLine();
			fwlocal.flush();
			
			
			str = Boolean.toString(newBigBetWholeCheckBox.isSelected());
			
			fwlocal.append(str);
			fwlocal.newLine();
			fwlocal.flush();
			
			str = newBigMinRatioTextField.getText();
			
			fwlocal.append(str);
			fwlocal.newLine();
			fwlocal.flush();
			
			
			str = Boolean.toString(ignoreRedcardCheckBox.isSelected());
			
			fwlocal.append(str);
			fwlocal.newLine();
			fwlocal.flush();
			
			
			fwlocal.close();
			
			
			

			

			return true;
			
			
			
		}catch(Exception e){
			e.printStackTrace();
			
		}
		
		return false;
	}
	
	
	
	
	
	

}
